﻿using Sustainalytics.ClientDW.Entities;
using Sustainalytics.ESG.Entities;
using Sustainalytics.ESGRatings.BusinessLogic.Models;
using System;
using System.Collections.Generic;

namespace Sustainalytics.ESGRatings.BusinessLogic.ESGOnlineReport
{
    public class ThemePerformance
    {
        public string ThemeName { get; set; }

        public RPPerformance Performance { get; set; }

        public bool IsInReferenceUniverse { get; set; }
    }

    public interface IOnlineResearchProductsBusinessLogicUnit
    {
        IEnumerable<Tuple<int, string>> GetIndicatorsClusters(string themeName);

        IEnumerable<ESGRpIndicator> GetIndicatorsByCompanyThemeAndCluster(Guid companyGuid, Guid esgProfileId, string theme, string clusterName, IEnumerable<int> universeIds, string indicatorNumber, int? skip = null, int? take = null);

        ThemePerformance GetThemePerformance(Guid companyId, Guid esgProfileId, string themeName, IEnumerable<int> universeIds);

        IEnumerable<ESG.Entities.RPControversyIndicator> GetControversyIndicatorsByCompanyId(Guid companyId, IEnumerable<int> universeIds);

        EsgOverallPerformanceSummary GetEsgOverallPerformanceSummary(Guid companyId, Guid esgProfileId);

        EsgRelativePosition GetEsgRelativePosition(Guid companyId, Guid esgProfileId);
    }

    //not found in universes
    public class ESGReasearchNotInUniversesException : Exception
    {
        private const string defaultMessage = "Research available with additional subscription.";

        public ESGReasearchNotInUniversesException() : this(defaultMessage)
        {
        }
        public ESGReasearchNotInUniversesException(string message) :
            this(message, null)
        { }

        public ESGReasearchNotInUniversesException(string message, Exception innerException) : base(string.IsNullOrEmpty(message) ? defaultMessage : message, innerException) { }
    }

    //not found in universes
    public class ESGReasearchNotFoundException : Exception
    {
        private const string defaultMessage = "Research not available.";
        public ESGReasearchNotFoundException() : this(defaultMessage)
        {
        }
        public ESGReasearchNotFoundException(string message) :
            this(message, null)
        { }

        public ESGReasearchNotFoundException(string message, Exception innerException) : base(string.IsNullOrEmpty(message) ? defaultMessage : message, innerException) { }
    }

}


